package com.it.tydic.estate.module.controller.xqgl;

import com.it.tydic.estate.common.annotation.ControllerDesc;
import com.it.tydic.estate.common.aop.Result;
import com.it.tydic.estate.common.constants.LogConstants;
import com.it.tydic.estate.module.model.inner.Cqbggl;
import com.it.tydic.estate.module.service.CqbgglService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * 产权变更
 */
@RestController
@RequestMapping("cqbggl")
@Api(tags = "房间产权变更")
public class CqbgglController {
    @Autowired
    private CqbgglService cqbgglService;
    /**
     * 新增或修改变更产权记录
     *

     * @return
     */
    @PostMapping("/addOrUpload")
    @ApiOperation(value = "新增或修改变更产权记录")
    @ControllerDesc(description = LogConstants.addOrUpdate_data)
    public Result addOrUpload(@RequestBody Cqbggl cqbggl) {

        return cqbgglService.addOrUpload(cqbggl);
    }
    /**
     * 条件分页查房间变更产权记录
     *
     * @param fjglMap 查询条件
     * @return
     */
    @PostMapping("query")
    @ApiOperation(value = "条件分页查房间变更产权记录")
    public Result queryList(@RequestBody Map<String, Object> fjglMap) {
        return cqbgglService.queryList(fjglMap);
    }
    /**
     * 批量删除
     *
     * @param list 主键集合
     * @return
     */
    @PostMapping("/deleteBatch")
    @ApiOperation(value = "批量删除")
    @ControllerDesc(description = LogConstants.delete_data)
    public Result deleteBatch(@RequestBody List<String> list) {
        return cqbgglService.deleteBatch(list);
    }
    /**
     * 根据主键查询房间变更产权记录
     *
     * @return
     */
    @GetMapping("queryById/{id}")
    @ApiOperation(value = "根据主键查询房间变更产权记录")
    public Result queryById(@PathVariable String id) {
        return cqbgglService.queryById(id);
    }

    /**
     * 根据主键变更产权
     * @param id
     * @return
     */
    @GetMapping("changeById/{id}")
    @ApiOperation(value = "根据主键变更产权")
    public Result changeById(@PathVariable String id) {
        return cqbgglService.changeById(id);
    }

}
